<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		 <input id="Btn1" type="button" value="+" name=""/>
		 <input id="Btn2" type="button" value="-" name=""/>
		  <input id="Btn3" type="button" value="护眼" name=""/>
		   <input id="Btn4" type="button" value="夜间" name=""/>
		 <p id="p1" style="font-size:12px;">这是一些文字这是一些文字这是一些文字这是一些文字</p>
		 <script>
			     
		          
		          var oPtxt=document.getElementById("p1");
		          var oBtn1=document.getElementById("Btn1");
		          var oBtn2=document.getElementById("Btn2");
				  var oBtn3=document.getElementById("Btn3");
				   var oBtn4=document.getElementById("Btn4");
		          var num = 14; /*定义一个初始变量*/
				  
				  if(localStorage.fontSize){
					   oPtxt.style.fontSize=localStorage.fontSize;
				  }
				  if(localStorage.bgColor){
				  	  document.bgColor=localStorage.bgColor;
				  }
				  if(localStorage.color){
				  	oPtxt.style.color=localStorage.color;
				  }
		          oBtn1.onclick = function(){
					  
		              num++;
		             oPtxt.style.fontSize=num+'px';
					 localStorage.fontSize=oPtxt.style.fontSize;
		          };
		          oBtn2.onclick = function(){
		              num--;
		              oPtxt.style.fontSize=num+'px';
					   localStorage.fontSize=oPtxt.style.fontSize;
		          }
				  oBtn3.onclick = function(){
					  document.bgColor="f5deb3";
					  oPtxt.style.color="black";
					  localStorage.bgColor= document.bgColor;
					  localStorage.color=oPtxt.style.color;
				  }
				  oBtn4.onclick = function(){
				  	document.bgColor="night";
					oPtxt.style.color="white";
					localStorage.bgColor= document.bgColor;
					localStorage.color=oPtxt.style.color;
				  }
		    
		  </script>
	</body>
</html>
